package com.littlerpc.protocol.net.netty.server;

import com.littlerpc.protocol.net.common.*;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 *
 * @author ChengPeng
 * @date 2017/6/15
 */
public class NettyServerHandler extends SimpleChannelInboundHandler<RpcRequest> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, RpcRequest msg) throws Exception {
        RpcResponse rpcResponse = ServiceBeanResource.invokeService(msg);
        ctx.writeAndFlush(rpcResponse);
    }
}
